//
//  KFDWithdrawViewController.m
//  KFD
//
//  Created by JIRENTIANXIANG on 7/2/15.
//  Copyright © 2015 kfd. All rights reserved.
//

#import "KFDWithdrawViewController.h"
#import "KFDAccountManager.h"
#import "JTToast.h"
#import "NSMutableDictionary+checkForNil.h"

@interface KFDWithdrawViewController ()

@property (strong,nonatomic) UIWebView* webView;

@end

@implementation KFDWithdrawViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self.uiConfigurator configureNavigationBarWithBackAction:@selector(goBack)];
    self.title=@"取款";
    self.webView=[[UIWebView alloc] initWithFrame:self.view.bounds];
    [self.view addSubview:self.webView];
    KFDAccountManager* manager=[KFDAccountManager sharedManager];
    NSHTTPCookie* cookie=manager.financialServiceCookie;
    if (cookie) {
        NSMutableURLRequest* request=[NSMutableURLRequest requestWithURL:[NSURL URLWithString:manager.withdrawUrl]];
        NSDictionary* cookieHeaderField=[NSHTTPCookie requestHeaderFieldsWithCookies:@[cookie]];
        [request setValue:cookieHeaderField[@"Cookie"] forHTTPHeaderField:@"Cookie"];
        [self.webView loadRequest:request];
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(void)goBack
{
    [self.navigationController popViewControllerAnimated:YES];
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
